# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-django-otp
_pyname=django_otp
pkgver=1.5.0
pkgrel=1
arch="noarch"
pkgdesc="A pluggable framework for adding two-factor authentication to Django using one-time passwords."
url="https://pypi.python.org/project/django-otp"
license="BSD-2-Clause"
# also supports py3-segno
depends="
	py3-django
	py3-qrcode
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	py3-hatchling
	"
checkdepends="
	py3-freezegun
	"
source="$pkgname-$pkgver.tar.gz::https://pypi.io/packages/source/d/django-otp/django_otp-$pkgver.tar.gz"
builddir="$srcdir"/$_pyname-$pkgver
subpackages="$pkgname-pyc"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	PYTHONPATH="test" \
	DJANGO_SETTINGS_MODULE="test_project.settings" \
	.testenv/bin/python3 -s -m django test -v 2 django_otp
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

sha512sums="
0169804992b155dfa88fbc0d695091f3f03225f28a104c595e7790f174ff3f4943280b7a3dbb3d4c263cc1bad0ea0370e4749d8d0b1df1e3675881365fc15dfe  py3-django-otp-1.5.0.tar.gz
"
